$From = "GroupAudit@corp.resmed.org" 
$To = "itopsusa@resmed.com" 
$SMTPServer = "us1smtp01.corp.resmed.org" 
$SMTP = new-object Net.Mail.SmtpClient($SMTPServer) 
$GFile = New-Item -type file -force "C:\Scripts\SGroupMemberDetails.csv" 
$N = 0 
$SName = "localhost"
"Server Name -  $SName" | Out-File $GFile -encoding ASCII -append 
$group = [ADSI]("WinNT://$SName/Administrators,group")   
$GMembers = $group.psbase.invoke("Members") 
$GMembers | ForEach-Object {$_.GetType().InvokeMember("Name",'GetProperty', $null, $_, $null) | Out-File $GFile -encoding ASCII -append 
$N++ 
} 
    If ($N -lt 2) 
        { 
        $Sub = "Administrator Group Details on $SName Server" 
        $Ebody = "Administrator Group on $SName Server has $N members." 
        $SMTP.Send($From, $To, $Sub, $Ebody) 
        #Add specific details/function here.   
        } 
    Else  
        { 
          
        } 
        